Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load extensions from DevTools server instead of using stubs. #6097

Merged
merged 5 commits into from
Jul 26, 2023

Conversation

kenzieschmoll
Copy link
Member

#6094 needs to land first before this can land.

Work towards #1632

var fileUri = await serviceManager.rootLibraryForSelectedIsolate();
if (fileUri == null) return null;

if (fileUri.endsWith('/lib/main.dart')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the root library isn't main.dart? There's no requirement for the entry point of a Dart or Flutter program to be in main.dart. I'm not even sure there's a requirement for it to be in a library of the form lib/<script> for Flutter, but there definitely isn't for Dart programs.

Copy link
Member Author

@kenzieschmoll kenzieschmoll Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a convention for finding the root directory that contains the .dart_tool folder? Is this guaranteed to always be the parent of lib/?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, especially if you don't have access to the FS. If you did, you'd just walk the directory chain until you found the directory containing .dart_tool.

I think you're probably safe to assume that the entrypoint is under lib/, so if you update this to fileUri.endsWith(RegExp(r'\/lib\/[^\/.]*.dart')) this should work the vast majority of the time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally, I could just pass the whole root library to the server and have the server look for the .dart_tool folder?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd be the most accurate way of handling it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used the regexp for now but added a todo to move this logic to the server.

packages/devtools_app/lib/src/service/service_manager.dart Outdated Show resolved Hide resolved
packages/devtools_app/lib/src/service/service_manager.dart Outdated Show resolved Hide resolved
@kenzieschmoll kenzieschmoll merged commit 8f57853 into flutter:master Jul 26, 2023
15 checks passed
@kenzieschmoll kenzieschmoll deleted the dte-server-2 branch July 26, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants